<?php 
$this->Html->script('fancybox/jquery.mousewheel-3.0.4.pack.js', array('block' => 'script'));
$this->Html->script('fancybox/jquery.fancybox-1.3.4.pack.js', array('block' => 'script'));
$this->Html->css('/js/fancybox/jquery.fancybox-1.3.4.css', array('block' => 'css'));
?>
<?php echo $this->element('banner');?>
<div class="container">
    <div id="sub-page" class="row">
        <div class="col-lg-8">
            <h2><?php echo __('Kyouwa gallery')?></h2>
            <div class="row">
			<?php 
            foreach($galleries as $key=>$gallery) :
                if($key && $key % 4 == 0) :
                    echo '</div>';
                    echo '<div class="row">';
                endif;
            ?>
                <div class="col-lg-3 home-product gallery-row">
                    <div class="product-list gallery">
                    	<a title="<?php echo @$gallery['Gallery']['name' . $code]?>" rel="example_group" href="/files/images/<?php echo $gallery['Gallery']['image']?>">
							<img alt="" src="/files/images/<?php echo $gallery['Gallery']['image']?>" width="145" height="120"/>
						</a>
                    </div>        	
                </div>
			<?php endforeach;?>
            </div>
			<?php if($this->Paginator->counter('{:pages}') > 1) :?>
            <nav>
                <div class="pagination">
                <?php
                    echo $this->Paginator->prev('&laquo; ', array('escape' => false,'tag' => 'li'), '&laquo; ', array('escape' => false, 'tag' => 'span'));
                    echo $this->Paginator->numbers(array('separator' => '', 'tag' => 'li', 'currentTag' => 'span', 'currentClass' => 'active'));
                    echo $this->Paginator->next(' &raquo;', array('tag' => 'li', 'escape' => false), ' &raquo;', array('tag' => 'span', 'escape' => false));
                ?>
                </div>
            </nav>
            <?php endif;?>
            
        </div>
        <?php echo $this->element('News/side-left');?>
    </div>
</div>

<?php echo $this->element('partner');?>
<script>
$(document).ready(function() {
	$("a[rel=example_group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
</script>